package testcircuits;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;

import circuits.NotOperator;

public class TestNotOperator {
	
	private NotOperator notOperator;
	
	private StubFalseOperator falseOperator;
	private StubTrueOperator trueOperator;
	
	@Before
	public void setUp(){
		this.falseOperator = new StubFalseOperator();
		this.trueOperator = new StubTrueOperator();
	}
	
	@Test
	public void setTrueBooleanValueNotOperatorReturnsFalse(){
		this.notOperator = new NotOperator(true);
		
		assertFalse(this.notOperator.getResult());
	}
	
	@Test
	public void setFalseBooleanValueNotOperatorReturnsTrue(){
		this.notOperator = new NotOperator(false);
		
		assertTrue(this.notOperator.getResult());
	}
	
	@Test
	public void setTrueOperandNotOperatorReturnsFalse(){
		this.notOperator = new NotOperator(this.trueOperator);
		
		assertFalse(this.notOperator.getResult());
	}
	
	@Test
	public void setFalseOperandNotOperatorReturnsTrue(){
		this.notOperator = new NotOperator(this.falseOperator);
		
		assertTrue(this.notOperator.getResult());
	}
}
